how to print distinct elements from an array in c